home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 5
/
The 640 Meg Shareware Studio CD-ROM Volume V (Data Express)(1994).ISO
/
amiga
/
tdemo2.lha
/
ProgrammersInfo
/
Conference.mod.c
next >
Wrap
C/C++ Source or Header
|
1994-06-05
|
6KB
|
263 lines
/*
================================================================================
PROGRAM: Conference Access Lister Module
VERSION: v1.0
COMPILER: Lattice C v5.10b
DATE: Oct 15 1992
================================================================================
[Conference Access Lister Module v1.0] By The SkeletoN [__-__-__]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Handle Location 1st On LastOn Calls Msgs
====================--====================--======--======--=====--=====
User 1 Location User 1 May 31 Jun 32 1,209 1,484
User 2 Location User 2 Jun 22 Jul 23 323 131
====================--====================--======--======--=====--=====
[Q=Quit]-[Return=Continue]:
*/
//**********************
//***** Includes *****
//**********************
#include <proto/all.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <tempest/headers.h>
//********************************
//***** Structures/Defines *****
//********************************
//*********************
//***** Structs *****
//*********************
struct MyMessage
{
struct Message Msg; // for Exec message routines
ULONG Command; // Command to be executed.
char *text1,
*text2,
*text3;
int Value1,
Value2;
ULONG LongValue;
LONGBITS Flags;
int carrier;
struct User *User;
struct SystemData *SystemData;
struct NodeData *NodeData;
struct Today *Today;
};
struct User *User;
struct User User1;
struct MsgPort *MyPort = NULL;
struct MyMessage *msg;
struct MyMessage send;
int DoorStart(TEXT *);
int DOORIO(VOID);
VOID CloseStuff(VOID);
VOID GetPaths(TEXT *,int);
int hotkey(TEXT *);
VOID pl(TEXT *);
int CTRLC(VOID);
char MyName[60],st[60];
//******************
//***** Main *****
//******************
VOID main(int argc,char *argv[])
{
char string1[200],shit1[200],Month[5],Day[4],Year[4];
register int TotalUsers=0,Users=0,Lines=0;
int stat,fd;
if(!DoorStart(argv[1])) { PutStr("Tempest Door!\n"); exit(0); }
//******************
//***** Code *****
//******************
strcpy(shit1,"
=========================-=========================--=========--====--====--====\r\n");
pl("\f
[
Conference Access Lister Module v3.15
] By Michael Bockert
[
05-24-94
]\r\n");
pl("
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n");
GetPaths(string1,1);
strcat(string1,"Accounts.data");
fd=Open(string1,MODE_OLDFILE);
pl("
Handle Location Last On Calls Msgs\r\n");
pl(shit1);
ACCOUNTS:
stat=Read(fd,&User1, sizeof(struct User));
if(stat<1)
{
Close(fd);
pl(shit1);
sprintf(shit1,"
Total Users
[
%3d
]
Users In Conference
[
%d
]\r\n\r\n",TotalUsers,Users);
pl(shit1);
CloseStuff();
}
if(CTRLC())
{
Close(fd);
pl("\r\n
Aborting List!
\r\n\r\n");
CloseStuff();
}
TotalUsers++;
if(User1.MsgBase[User->MB_J] != 'N')
{
Users++;
strcpy(string1,ctime(&User1.Time_Last_Logoff));
strmid(string1,Year,23,2);
strmid(string1,Month,5,3);
strmid(string1,Day,9,2);
sprintf(string1,"
%-25.25s
%-25.25s
%s %s
/
%s
%4.4d
%4.4d\r\n",
User1.Name,User1.City,Month,Day,Year,User1.Total_Calls,User1.Total_Posts);
pl(string1);
Lines++;
}
if(Lines+2 > User->Length)
{
pl("\r\n
[
Q
=
Quit
]-[
Return
=
Continue
]
:");
AGAIN:
hotkey(string1);
if((string1[0] == 'Q') || (string1[0] == 'q'))
{
pl("\r\n\r\n");
Close(fd);
CloseStuff();
}
if(string1[0] != 13)
goto AGAIN;
Lines=0;
pl("\r\n\r\n");
}
goto ACCOUNTS;
}
//************************
//***** Door Start ***** // MUST BE INCLUDED IN ALL DOORS!
//************************
int DoorStart(TEXT *node)
{
struct MsgPort *HisPort;
send.carrier=0;
sprintf(st,"%s:TEMPEST_DOOR",node);
HisPort = FindPort(st);
if(HisPort==NULL) return (FALSE);
sprintf(MyName,"%s:DOOR_PORT",node);
MyPort = CreatePort(MyName,0L);
if(MyPort==NULL)
{
PutStr("Cant open port");
return(int)FALSE;
}
DOORIO();
User=*&send.User;
return (int)TRUE;
}
//********************
//***** DoorIO ***** // MUST BE INCLUDED IN ALL DOORS!
//********************
int DOORIO(VOID)
{
struct MsgPort *HisPort;
if(send.carrier) return(0);
HisPort = FindPort(st);
if(HisPort!=NULL)
{
send.Msg.mn_Node.ln_Type = NT_MESSAGE;
send.Msg.mn_Length = sizeof(send);
send.Msg.mn_ReplyPort = MyPort;
send.carrier=0;
PutMsg((struct MsgPort *)HisPort,(struct Message *)&send);
Wait(1 << MyPort->mp_SigBit);
GetMsg(MyPort);
if(send.carrier) CloseStuff();
return(1);
}
return(0);
}
//*************************
//***** Close Stuff ***** // MUST BE INCLUDED IN ALL DOORS!
//*************************
VOID CloseStuff(VOID)
{
send.Command=999;
DOORIO();
while(msg=(struct MyMessage *)GetMsg(MyPort)) ReplyMsg((struct Message *)msg);
if(MyPort) DeletePort(MyPort);
exit(0);
}
//*********************
//***** Hot Key ***** // Command 16
//*********************
int hotkey(TEXT *character)
{
send.Command=16;
send.text1=character;
DOORIO();
return((int)character[0]);
}
//***********************
//***** Get Paths ***** // Command 30
//***********************
VOID GetPaths(TEXT *s,int opt)
{
send.Command=30;
send.Value1=opt;
strcpy(s,NULL);
send.text1=s;
DOORIO();
}
//*****************************
//***** PL (Print Line) ***** // Command 1
//*****************************
VOID pl(TEXT *string)
{
send.Command=1;
send.text1=string;
DOORIO();
}
//*************************
//***** CTRLC CHECK ***** // Command 10
//*************************
int CTRLC(VOID)
{
send.Command=10;
DOORIO();
return(send.Value1);
}